<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>添加付款方式信息</title>

<base target="_self" />

<link href="Styles/css.css" rel="stylesheet" type="text/css" />
<link href="Styles/ts_css.css" rel="stylesheet" type="text/css" />
<script src="Scripts/My97DatePicker/WdatePicker.js"
	type="text/javascript"></script>
<script src="Scripts/jquery-1.4.1.min.js" type="text/javascript"></script>
<script src="Scripts/IndexManager.js" type="text/javascript"></script>
<!-- <script src="Scripts/jquery.min.js" type="text/javascript" ></script>
<script src="Scripts/jquery.validate.min.js" type="text/javascript" ></script> -->

<script type="text/javascript">
	//添加楼栋信息
 		
	function addAjax() {
		//alert("走了么");
		$.ajax({
					data : {
						pay_type_name : $("#payTypeName").val(),
						apply_scope : $("#applyScope").val(),
						pay_type_kind : $("#payTypeKind").val(),
						explains : $("#explains").val(),
						discount : $("#discount").val()

					},
					type : "POST",
					datatype : 'json',
					url : "${pageContext.request.contextPath}/add.do",
					error : function(data) {
						//alert(data);
						alert("出错了");
					},
					success : function(data) {
						/* 				jQuery.each(data.projectList,function(i,item){
						 alert(item.id+","+item.name);
						 }); */

						//alert(data);
						alert("添加付款方式成功");
						window.location.href = "${pageContext.request.contextPath}/toList.do";
					}
				});
	}
	
	//关闭当前页面
	function page_Close() {
		if (window.parent != null) {
			window.parent.close();
		} else {
			window.close();
		}
	}
</script>

<script type="text/javascript">
	function payTypeName() {

		var pay_type_name = document.getElementById("payTypeName").value;
		
		if (pay_type_name == ""||pay_type_name==null) {
			alert("付款方式名称不能为空");
			pay_type_name.focus();
			return false;
		}
		return true;
	}

	function applyScope() {
		var apply_scope = $("#applyScope").val();
		if (apply_scope == ""||apply_scope==null) {
			alert("使用范围不能为空");
			$("#applyScope").focus();
			return false;
		}
		return true;
	}

	function payTypeKind() {
		var pay_type_kind = $("#payTypeKind").val();
		if (pay_type_kind == "" || pay_type_kind==null) {
			alert("付款方式类型不能为空");
			$("#payTypeKind").focus();
			return false;
		}
		return true;
	}

	function explainss() {
		var explains = $("#explains").val();
		if (explains == "" ||explains==null) {
			alert("百分比不能为空");
			$("#explains").focus();
			return false;
		}
		return true;
	}

	function discounts() {
		var discount = $("#discount").val();
		if (discount == "" || discount==null) {
			alert("折扣不能为空");
			$("#discount").focus();
			return false;
		}
		return true;
	}

</script> 

</head>
<body>

	<form id="form1" method="post" name="form1" action="add.do">
		<div id="divTwo">
			<table width="100%" border="0" cellpadding="3" cellspacing="3"
				class="table_list1">
				<h2 align="center">添加付款方式信息</h2>
				<tr>
					<td width="50%" class="table_list1_style1">
						<p></p> <span style="color: Red">*</span> 付款方式名称:
					</td>
					<td width="50%" class="table_list1_style2"><input type="text"
						id="payTypeName" name="payTypeName" onblur="payTypeName()"/></td>

				</tr>
				<tr>
					<td width="10%" class="table_list1_style1">
						<p></p> <span style="color: Red">*</span> 付款方式范围:
					</td>
					<td width="10%" class="table_list1_style2"><input type="text"
						id="applyScope" name="applyScope" onblur="applyScope()"/></td>
				</tr>
				<tr>
					<td width="10%" class="table_list1_style1">
						<p></p> <span style="color: Red">*</span> 付款方式类型:
					</td>
					<td width="10%" class="table_list1_style2"><input type="text"
						id="payTypeKind" name="payTypeKind" onblur="payTypeKind()"/></td>

				</tr>
				<tr>
					<td width="10%" class="table_list1_style1">
						<p></p> <span style="color: Red">*</span> 百分比:
					</td>
					<td width="10%" class="table_list1_style2"><input type="text"
						 id="explains" name="explains" onblur="explainss()"/>
						 </td>
				</tr>
				<tr>
					<td width="10%" class="table_list1_style1"><p></p> 折扣:</td>
					<td width="10%" class="table_list1_style2"><input type="text"
						id="discount" name="discount" onblur="discounts()" /></td>
				</tr>

				<tr>
					<td class="table_list1_style1">

						<p></p> <input type="submit" value="提交" />
					</td>
					<td width="1%" class="table_list1_style2">

						<p></p> <input type="button" class="button" value="关闭"
						tabindex="1" onclick="page_Close()" />
					</td>
					<td class="table_list1_style1">&nbsp;</td>
				</tr>
			</table>
		</div>
	</form>
</body>
</html>